package org.oy.sealogger.common;

/**
 * Message class to be used with MessageQueue
 * @author riku
 *
 */
public class Message {

	public static enum MessageType { INFO, WARNING, ERROR }
	
	private String source;
	private String message;
	private MessageType type;
	
	/**
	 * Constructs a new Message object
	 * @param source Message source description
	 * @param message 
	 * @param type INFO/WARNING/ERROR
	 */
	public Message(String source, String message, MessageType type) {
		this.source = source;
		this.message = message;
		this.type = type;
	}
	
	/**
	 * Get message source description
	 * @return
	 */
	public String getSource() {
		return source;
	}
	
	/**
	 * Get the message itself
	 * @return
	 */
	public String getMessage() {
		return message;
	}
	
	/**
	 * Get the message type (Message.MessageType)
	 * @return
	 */
	public MessageType getType() {
		return type;
	}
	
	/**
	 * Get all message information in a formatted string. The format
	 * is: "TYPE - Source: Message"
	 * @return
	 */
	public String getFormattedMessage() {
		return type.toString() + " - " + source + ": " + message;
	}
}
